<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Creates new PI node</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="domdocument.createentityreference.html">« DOMDocument::createEntityReference</a></li>
      <li style="float: right;"><a href="domdocument.createtextnode.html">DOMDocument::createTextNode »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.domdocument.html">DOMDocument</a></li>
    <li>Creates new PI node</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="domdocument.createprocessinginstruction" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DOMDocument::createProcessingInstruction</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DOMDocument::createProcessingInstruction</span> &mdash; <span class="dc-title">Creates new PI node</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-domdocument.createprocessinginstruction-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>DOMDocument::createProcessingInstruction</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$target</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code><span class="initializer"> = &quot;&quot;</span></span>): <span class="type"><span class="type"><a href="class.domprocessinginstruction.html" class="type DOMProcessingInstruction">DOMProcessingInstruction</a></span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">
   This function creates a new instance of class
   <span class="classname"><a href="class.domprocessinginstruction.html" class="classname">DOMProcessingInstruction</a></span>. 此节点出现在文档中，除非是用诸如
<span class="function"><a href="domnode.appendchild.html" class="function">DOMNode->appendChild()</a></span> 等函数来将其插入。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-domdocument.createprocessinginstruction-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">target</code></dt>

     <dd>

      <p class="para">
       The target of the processing instruction.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">data</code></dt>

     <dd>

      <p class="para">
       The content of the processing instruction.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-domdocument.createprocessinginstruction-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   The new <span class="classname"><a href="class.domprocessinginstruction.html" class="classname">DOMProcessingInstruction</a></span> or <strong><code>false</code></strong> if an error occurred.
  </p>
 </div>

 <div class="refsect1 errors" id="refsect1-domdocument.createprocessinginstruction-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   <dl>
    
     <dt>
<strong><code>DOM_INVALID_CHARACTER_ERR</code></strong></dt>

     <dd>

      <p class="para">
       Raised if <code class="parameter">target</code> contains an invalid character.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-domdocument.createprocessinginstruction-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="domnode.appendchild.html" class="methodname" rel="rdfs-seeAlso">DOMNode::appendChild()</a> - Adds new child at the end of the children</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createattribute.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createAttribute()</a> - Create new attribute</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createattributens.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createAttributeNS()</a> - Create new attribute node with an associated namespace</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createcdatasection.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createCDATASection()</a> - Create new cdata node</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createcomment.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createComment()</a> - Create new comment node</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createdocumentfragment.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createDocumentFragment()</a> - Create new document fragment</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createelement.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createElement()</a> - Create new element node</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createelementns.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createElementNS()</a> - Create new element node with an associated namespace</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createentityreference.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createEntityReference()</a> - Create new entity reference node</span></li>
    <li class="member"><span class="methodname"><a href="domdocument.createtextnode.html" class="methodname" rel="rdfs-seeAlso">DOMDocument::createTextNode()</a> - Create new text node</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>